/*
	Tester clas for Part3.

	This class creates some shapes, adds them a LinkedList object using
	the addLast method defined in the LinkedList class, then replaces
	some shapes using the set method defined in the LinkedList class.

	DO NOT MODIFY THE CONTENTS OF THIS FILE.

*/


public class Part3Tester
{
	private static int MAX_SHAPES = 10;

	public static void main(String [] args)
	{
		Shape [] shapes = new Shape[MAX_SHAPES];
		int i;

		shapes[0] = new Square(4);
		shapes[1] = new Circle(1);
		shapes[2] = new Square(8);
		shapes[3] = new Circle(2);
		shapes[4] = new Square(4);
		shapes[5] = new Square(4);
		shapes[6] = new Circle(1);
		shapes[7] = new Square(8);
		shapes[8] = new Circle(2);
		shapes[9] = new Square(4);


		LinkedList list = new LinkedList();

		System.out.println("Calling set with index outside range of list...");
		list.set(0, shapes[0]);

		//add some shapes to list
		for (i = 0; i < shapes.length; i++)
			list.addLast(shapes[i]);

		//print the shapes
		System.out.println("\nPrintout of shapes in initial list");
		System.out.println("List size is: " + list.length());
		System.out.println(list);

		//update list using set
		for (i = -1; i <=shapes.length; i++)
			list.set(i, shapes[0]);

		System.out.println("\nPrintout of shapes after replacing shapes using set method...");
		System.out.println(list);



	}//end main method

}//end class Part3Tester